<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection"
          content="telephone=no,email=no,date=no,address=no">
    <title>技师列表</title>
    <link rel="stylesheet" href="${ctxPath}/static/assets/aui/css/aui.css" media="all">
    <link rel="stylesheet" href="${ctxPath}/static/assets/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPath}/static/css/common.css" media="all">
    <!-- jQuery Include -->
    <script type="text/javascript" src="${ctxPath}/static/assets/scripts/jquery.min.js"></script>
    <script type="text/javascript" src="${ctxPath}/static/js/common.js"></script>
    <style>
        .aui-list-item-media > img {
            height: 5rem;
            width: 5rem;
        }

        .aui-content::-webkit-scrollbar {
            display: none
        }

        .weui-flex__item > div {
            font-size: 12px;
            color: #666666;
        }

        .aui-media-list-item-inner > img {
            height: 5rem;
            width: 5rem;
        }

        #content {
            width: 100%;
            position: absolute;
            top:4.7rem;
            z-index: 999;
            background-color: white;
            display: none;
            overflow-y: auto;
        }

        .aui-margin-r-1 {
            float: right;
            position: absolute;
            right: 0px;
            height: 28px;
            top: 0px;
            line-height: 2;
        }

        .aui-row > div > div > .aui-active {
            color: orange;
        }

        #list > li > div > div > div > div > div {
            color: #757575;
            font-size: 12px;
        }
        #que{
            width: 50%;
            float: right;
        }
        #quxiao{
            width: 50%;
            float: left;
        }
        #loading>img{
            top: 15%;
            position: absolute;
            text-align: center;
            width: 50px;
            height: 50px;
        }
       #choose-info {
            height: 2.5rem;
           line-height: 2.5rem;
           background-color: #f2f2f2;
        }
        #choose-info>div>div{
            text-align: center;
        }
        #choose-info>div>div>i{
            top: 1px;
        }
        #selectSort{
            width: 100%;
            top:4.7rem;
            position: absolute;
            display: none;
            z-index: 999;
            background-color: #03a9f4
        }
        #selectType{
            width: 100%;
            top:4.7rem;
            position: absolute;
            display: none;
            z-index: 999;
            background-color: #03a9f4
        }
        #selectCity{
            width: 100%;
            top:4.7rem;
            position: absolute;
            display: none;
            z-index: 999;
            background-color: #03a9f4
        }
        #away{
            height: 100px;
            overflow-y: auto;
            display: none;
        }
    </style>
</head>

<body>
<ul class="aui-list aui-form-list">
    <li>
        <header class="aui-bar aui-bar-nav">
            <div class="aui-title">技师列表</div>
        </header>
    </li>
    <li>
        <div class="aui-row" id="choose-info">
            <div class="aui-col-xs-3 " id="city">
                <div class=" aui-font-size-12" >
                    <i class="aui-iconfont aui-icon-location"></i>
                    <span id="location">成都</span>
                </div>
            </div>
            <div class="aui-col-xs-3">
                <div class=" aui-font-size-12" data_type="1">
                    <span class="artType" data_type="" data-type-id="">综合分类</span>
                    <i class="aui-iconfont aui-icon-menu"></i>
                </div>
            </div>
            <div class="aui-col-xs-3 " id="artSort">
                <div class=" aui-font-size-12" >
                    <span class="allSort">综合排序</span>
                    <i class="aui-iconfont aui-icon-down"></i>
                </div>
            </div>
            <div class="aui-col-xs-3" id="searchInfo">
                <div class=" aui-font-size-12">筛选
                    <i class="aui-iconfont aui-icon-search" ></i>
                </div>
            </div>
        </div>
    </li>
</ul>
<!--
        作者：offline
        时间：2019-06-02
        描述：人员列表
    -->
<div class="aui-content aui-margin-b-15">
    <ul class="aui-list aui-media-list" id="list">
        <!--加载中...-->
        <li class="aui-list-item aui-list-item-middle" style="text-align: center;display: none;">
            <i class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"
               style="font-size:25px;"></i>
            <div class="doc-icon-name" style="font-size: 10px;">加载中...</div>
        </li>
        <!--暂无相关信息-->
        <li class="aui-list-item aui-list-item-middle"
            style='display: none;line-height: 3;text-align: center;font-style: normal;font-size: 14px;width: 100%;height: 1.5rem;color: gray;margin-top: 15px;'>
            暂无相关技师信息!
        </li>
        <li class="aui-list-item aui-list-item-middle" style="display: block;">
            <div style="width: 100%;height: 5rem;">
                <img src="${ctxPath}/static/img/lufei.jpg"
                     style="height: 4rem;width: 4rem;top: 0.4rem;border-radius: 50%;position: absolute;left: 0;">
                <div style="position: absolute;right: 0;line-height: 0.9rem;top: 0.6rem;">
                    <div class="aui-row" style="margin-left: 5rem;">
                        <div class="aui-col-xs-2">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                路飞
                            </div>
                        </div>
                        <div class="aui-col-xs-2">
                            <div class=" aui-font-size-12" style="text-align: center;color: #9B59B6">
                                <i class="layui-icon layui-icon-female" style="font-size: 12px;"></i>
                            </div>
                        </div>
                        <div class="aui-col-xs-4">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                四川成都
                            </div>
                        </div>
                        <div class="aui-col-xs-3">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                <i class="aui-iconfont aui-icon-location" style="font-size: 12px;color: #e51c23"></i>
                                99km
                            </div>
                        </div>
                    </div>
                    <div class="aui-row" style="margin-left: 5.3rem;">
                        <div class="aui-col-xs-10">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                人美屁股大,技术好，经验丰富，手法好,反正什么都好！！！！！！！
                            </div>
                        </div>
                    </div>
                    <div class="aui-row" style="margin-left: 5rem;">
                        <div class="aui-col-xs-2">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                四川
                            </div>
                        </div>
                        <div class="aui-col-xs-6">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                <span id="year">10</span>年工作经验
                            </div>
                        </div>
                        <div class="aui-col-xs-3">
                            <div class=" aui-font-size-12" style="text-align: center;">
                                9999单
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </li>
        <li class="aui-list-item aui-list-item-middle" style="background-color: #ececec;">
            <div class="aui-media-list-item-inner">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-text" style="color: #333;left:6rem;line-height: 1.2rem;">
                        没有更多了!
                    </div>
                </div>
            </div>
        </li>
    </ul>
</div>
<!--
        作者：offline
        时间：2019-06-02
        描述：导航
    -->
<footer class="aui-bar aui-bar-tab" id="footer">
    <div class="aui-bar-tab-item" onclick="examinePage()">
        <i class="aui-iconfont aui-icon-paper"></i>
        <div class="aui-bar-tab-label">周边服务</div>
    </div>
    <div class="aui-bar-tab-item aui-active">
        <i class="aui-iconfont aui-icon-menu"></i>
        <div class="aui-bar-tab-label">技师列表</div>
    </div>
    <div class="aui-bar-tab-item" onclick="orderPage()">
        <i class="aui-iconfont aui-icon-cart"></i>
        <div class="aui-bar-tab-label">订单列表</div>
    </div>
    <div class="aui-bar-tab-item" onclick="minePage()">
        <i class="aui-iconfont aui-icon-my"></i>
        <div class="aui-bar-tab-label">我的</div>
    </div>
</footer>
<!--弹出框选择城分类-->
<div id="selectSort">
    <ul class="aui-list aui-list-in aui-margin-b-15">
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-type="0">综合排序</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-type="1">评分最高</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-type="2">距离最近</div>
            </div>
        </li>
    </ul>
</div>

<!--弹出框选择城分类-->
<div id="selectType">
    <ul class="aui-list aui-list-in aui-margin-b-15">
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-view-professional-title="0">综合分类</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-view-professional-title="1">按摩</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-view-professional-title="2">足疗</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title" data-view-professional-title="3">针灸</div>
            </div>
        </li>
   <!--     <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">全身精油按摩</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">全套终极养生按摩</div>
            </div>
        </li>-->
    </ul>
</div>
<!--弹出框选择城市-->
<div id="selectCity">
    <ul class="aui-list aui-list-in aui-margin-b-15">
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">成都</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">重庆</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">上海</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">杭州</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">深圳</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">武汉</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">长沙</div>
            </div>
        </li>
        <li class="aui-list-item">
            <div class="aui-list-item-inner aui-list-item-arrow">
                <div class="aui-list-item-title">福州</div>
            </div>
        </li>
    </ul>
</div>
<!--搜索弹出框-->
<div id="content">
    <div class="aui-searchbar" id="area">
        <div class="aui-searchbar-input aui-border-radius" tapmode="">
            <i class="aui-iconfont aui-icon-search"></i>
            <form>
                <input type="search" placeholder="请输入搜索位置信息" id="areainfo" data_lng="" data_lat="">
            </form>
            <div class="aui-list-item-inner aui-list-item-center aui-list-item-btn">
                <div class="aui-btn aui-btn-info aui-margin-r-1" id="search-input">搜索</div>
            </div>
        </div>
    </div>
    <div class="aui-content aui-margin-b-15" id="areas">
        <ul class="aui-list aui-list-in">
            <li class="aui-list-header">
                周边地址
            </li>
        </ul>
        <ul class="aui-list aui-list-in" id="away"></ul>
    </div>
    <div class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-form-list">
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        性别
                    </div>
                    <div class="aui-list-item-input" id="sex">
                        <label><input class="aui-radio" type="radio" name="sex" value="2" checked=""> 不限</label>
                        <label><input class="aui-radio" type="radio" name="sex" value="0"> 女</label>
                        <label><input class="aui-radio" type="radio" name="sex" value="1"> 男</label>
                    </div>
                </div>
            </li>
            <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        是否在线
                    </div>
                    <div class="aui-list-item-input">
                        <input type="checkbox" class="aui-switch" checked="" id="isOnline">
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="aui-btn aui-btn-default aui-btn-block aui-btn-sm" id="quxiao">取消</div>
    <div class="aui-btn aui-btn-info aui-btn-block aui-btn-sm" id="que">确认</div>
</div>
<!--loading图显示-->
<div id="loading">
    <img src="${ctxPath}/static/assets/images/loading.gif" alt="loading.." />
</div>

</body>
<!-- map -->
<!--<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=b5Kjd0zcpNax99AmviHxR2tXKIMGDnDA"></script>-->
<script type="text/javascript">
    function examinePage() {
        location.href = "${ctxPath}/wechat/public/toPeripheryPage";
    }

    function orderPage() {
        location.href = "${ctxPath}/wechat/public/toOrderPage";
    }

    function minePage() {
        location.href = "${ctxPath}/wechat/public/toMinePage";
    }
</script>
<script>

    /**
     * <p>初始化或查询数据显示</p>
     *   location  选择服务的地址
     *   viewProfessionalTitle   技师选择的分类
     *   artSort   排序
     *   sex       性别
     *   isOnline  是否在线
     * */
    function init(array) {
        //请求后台数据
        $.ajax({
            type: "POST",
            url: "${ctxPath}/artificerMeans/orderList",
            dataType: 'json',
            async: false,
            data: {
                "viewProfessionalTitle": array.viewProfessionalTitle,
                "distanceSort":array.distanceSort,
                "sex": array.sex,
                "isOnline": array.isOnline,
                "consumerLongitude": array.consumerLongitude,
                "consumerLatitude": array.consumerLatitude,
                "evaluation":array.evaluation
            },
            success: function (result) {
                if (result.status == "0000"&&result.data.length>0) {
                    var data = result.data;
                    var content = "";
                    for (var i  in  data) {
                        var art = data[i];
                        content += "<li onclick='createOrder("+art.id+","+art.distincts+")' class=\"aui-list-item aui-list-item-middle\" style=\"display: block;border-bottom: 2px solid #f2f2f2;border-top: 2px solid #f2f2f2;\">\n" +
                            "            <div style=\"width: 100%;height:4rem;\">\n" +
                            "                <img src='http://www.tyler.org.cn/" + art.imgUrl + "' style=\"height:3.5rem;border: 1px solid #f2f2f2;width: 3.5rem;border-radius: 50%;top: 0.2rem;position: absolute;left: 23px;\">\n" +
                            "                <div style=\"position: absolute;right: 0;line-height: 1.3rem;top: 0.2rem;width: 70%;\">\n" +
                            "                    <div class=\"aui-content\" >\n" +
                            "                        <div class=\"aui-col-xs-2\" style='margin-left: 6px;'>\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;\">\n" +
                            "                                " + art.name + "\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"aui-col-xs-2\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;color: #9B59B6\">\n";
                        if (art.sex == "1") {
                            content += " <i class=\"layui-icon layui-icon-male\" style=\"font-size: 12px;\"></i>\n";
                        } else {
                            content += " <i class=\"layui-icon layui-icon-female\" style=\"font-size: 12px;\"></i>\n";
                        }

                        content += "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"aui-col-xs-4\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;\">\n" +
                            "                                四川成都\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"aui-col-xs-3\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;\">\n" +
                            "                                <i class=\"aui-iconfont aui-icon-location\" style=\"font-size: 12px;color: #e51c23\"></i>\n" +
                            "                                " + art.distincts + "km\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                    </div>\n" +
                            "                    <div class=\"aui-content\" >\n" +
                            "                        <div class=\"aui-col-xs-12\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;height: 1.3rem;width: 93%;\">\n" +
                            "                                " + art.remark + "\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                    </div>\n" +
                            "                    <div class=\"aui-content\" >\n" +
                            "                        <div class=\"aui-col-xs-3\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;\">\n" +
                            "                               " + art.serviceArea + "\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"aui-col-xs-5\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;\">\n" +
                            "                                <span id=\"year\">" + art.exNumber + "</span>年工作经验\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                        <div class=\"aui-col-xs-4\">\n" +
                            "                            <div class=\" aui-font-size-12\" style=\"text-align: center;\">\n" +
                            "                                9999单\n" +
                            "                            </div>\n" +
                            "                        </div>\n" +
                            "                    </div>\n" +
                            "                </div>\n" +
                            "            </div>\n" +
                            "        </li>";
                    }
                    content += " <li class=\"aui-list-item aui-list-item-middle\" style=\"background-color:#f2f2f2;\">\n" +
                        "            <div class=\"aui-media-list-item-inner\">\n" +
                        "                <div class=\"aui-list-item-inner\">\n" +
                        "                    <div class=\"aui-list-item-text\" style=\"color: #333;left:6rem;line-height: 1.2rem;\">\n" +
                        "                         没有更多了!\n" +
                        "                    </div>\n" +
                        "                </div>\n" +
                        "            </div>\n" +
                        "        </li>";
                    $("#list").html(content);
                }else{//没有内容
                    var  content="<li class=\"aui-list-item aui-list-item-middle\"\n" +
                        "            style='background-color: #eee;line-height: 3;text-align: center;font-style: normal;font-size: 14px;width: 100%;height: 1.5rem;color: gray;margin-top: 15px;'>\n" +
                        "            暂无相关技师信息!\n" +
                        "        </li>";
                    $("#list").html(content);
                }
            }
        });
    }
    var  array={};
    array.viewProfessionalTitle=null;
    array.distanceSort=null;
    array.sex=null;
    array.isOnline=null;
    array.consumerLongitude="104.0359000000";
    array.consumerLatitude="30.6408010000";
    array.evaluation=null;
    $(function () {
        //获取缓存中的经纬度
        var position = localStorage.getItem("position");
        if (position) {
            var obj = JSON.parse(position); // --> parse error
            array.consumerLongitude=obj.longitude;
            array.consumerLatitude=obj.latitude;
        }
        //初始化及查询方法
        init(array);
        //---------------------------提交筛选查询确认开始----------
        $("#que").click(function () {
            $("#content").fadeOut("slow");
            var lat=$("#areainfo").attr("data_lat");
            var lng=$("#areainfo").attr("data_lng");
            //去提交查询信息
            var sex = $('input[name="sex"]:checked').val();
            var isOnline=$("#isOnline:checked").length>0?"1":"0";
            if(!lng||!lat){
                var position=localStorage.getItem("position");
                if (position) {
                    var obj = JSON.parse(position); // --> parse error
                    lng=obj.longitude;
                    lat=obj.latitude;
                }else{
                    return;
                }
            }
            //后台查询
            array.consumerLongitude=lng;
            array.consumerLatitude=lat;
            array.sex=sex;
            array.isOnline=isOnline=="1"?true:false;
            init(array);
        })
        //---------------------------提交筛选查询确认结束----------

        $("#quxiao").click(function () {
            $("#content").hide();
        })
        
        //初始化上次选择的城市
        var currentCity = localStorage.getItem("currentCity");
        if (currentCity) {
            $("#location").text(currentCity);
        }

        $("#choose-info>div").each(function () {
            $(this).click(function () {
                var isExtends = $(this).find("div>.aui-active").length;
                if (isExtends) {
                    $(this).find("div>i").removeClass("aui-active");
                    if ($(this).find("div").attr("data_type") == "1") {
                        $("#selectType").fadeOut("slow");
                    }
                } else {
                   var ele= $("#choose-info>div");
                   for(var  i=0;i<ele.length;i++){
                       $(ele[i]).find("div>i").removeClass("aui-active");
                   }
                    $(this).find("div>i").addClass("aui-active");
                    if ($(this).find("div").attr("data_type") == "1") {
                        $("#content").hide();
                        $("#selectCity").hide();
                        $("#selectSort").hide();
                        $("#selectType").fadeIn("slow");
                    }
                }
            })
        })

        $("#selectType>ul>li").each(function () {
            $(this).click(function () {
                var type = $(this).find("div>div").text();
                $(".artType").attr("data_type", type);
                var  typeNumber=$(this).find("div>div").attr("data-view-professional-title");
                $(".artType").attr("data-type-id", typeNumber);
                //去查询
                array.viewProfessionalTitle=typeNumber;
                init(array);
                $(".artType").html(type.substr(0, 6));
                $(".artType").next().removeClass("aui-active");
                $("#selectType").fadeOut("slow");
            })
        })
        //===============================↓综合排序开始↓======================================
        $("#selectSort>ul>li").each(function () {
            $(this).click(function () {
                var type = $(this).find("div>div").text();
                var dataType = $(this).find("div>div").attr("data-type");
                if(dataType=="0"){
                    array.viewProfessionalTitle=null;
                    array.distanceSort=null;
                    array.sex=null;
                    array.isOnline=null;
                    array.evaluation=null;
                    init(array);
                }else if(dataType=="1"){//评分 evaluation  是否评分排序  默认false.
                    array.viewProfessionalTitle=null;
                    array.distanceSort=null;
                    array.sex=null;
                    array.isOnline=null;
                    array.evaluation=true;
                    init(array);
                }else{//距离
                    array.viewProfessionalTitle=null;
                    array.distanceSort=true;
                    array.sex=null;
                    array.isOnline=null;
                    array.evaluation=null;
                    init(array);
                }
                $(".allSort").html(type);
                $(".allSort").next().removeClass("aui-active");
                $("#selectSort").fadeOut("slow");
            })
        })
        //===============================↓综合排序结束↓======================================
        /*    var myGeo = new BMap.Geocoder();
            // 根据坐标得到地址描述
            myGeo.getLocation(new BMap.Point(104.02927,30.630942), function(result){
                if (result){
                    $("#area").text(result.address);
                }
            });*/
        //-------------------------测试圆球效果js------------------
        $("#city").click(function () {
            if ($("#selectCity").is(':hidden')) {
                $("#content").hide();
                $("#selectSort").hide();
                $("#selectType").hide();
                $("#selectCity").fadeIn("slow");
            } else {
                $("#selectCity").fadeOut("slow");
            }

        })

        $("#searchInfo").click(function () {
            if ($("#content").is(':hidden')) {
                $("#selectSort").hide();
                $("#selectType").hide();
                $("#selectCity").hide();
                $("#content").fadeIn("slow");
            } else {
                $("#content").fadeOut("slow");
            }

        })

        $("#artSort").click(function () {
            if ($("#selectSort").is(':hidden')) {
                $("#selectType").hide();
                $("#selectCity").hide();
                $("#content").hide();
                $("#selectSort").fadeIn("slow");
            } else {
                $("#selectSort").fadeOut("slow");
            }

        })

        $("#selectCity>ul>li").each(function () {
            $(this).click(function () {
                var city = $(this).children().children().text();
                $("#location").text(city);
                $.ajax({
                    type: "POST",
                    url: "${ctxPath}/wechat/public/getLatAndLng",
                    dataType: 'json',
                    data:{
                      address: city
                    },
                    async: false,
                    success: function (result) {
                        if (result.status == "0000" && result.data.status == "0") {
                            var location=result.data.result.location;
                            array.consumerLongitude=location.lng;
                            array.consumerLatitude=location.lat;
                            array.sex=null;
                            array.isOnline=null;
                            var lacationArray={};
                            lacationArray.longitude=location.lng;
                            lacationArray.latitude=location.lat;
                            localStorage.setItem("position",JSON.stringify(lacationArray));
                            init(array);
                        } else {//获取定位周边信息失败
                            alert("获取定位周边信息失败")
                        }
                    }
                });
                localStorage.setItem("currentCity", city);
                $("#selectCity").fadeOut("slow");
                $(".aui-row>div>div>i").removeClass("aui-active");
            })
        })
        //--------------------------点击周边搜索----------------
        $("#search-input").click(function () {
            // 失去焦点查询
            var searchContent = $("#areainfo").val();
            if (!searchContent) {
                return
            }
            //查询
            $.ajax({
                type: "get",
                url: "${ctxPath}/wechat/public/getAways",
                dataType: 'json',
                async: false,
                data: {
                    "area": $("#location").text(),
                    "location": searchContent
                },
                contentType: "application/json; charset=utf-8",
                success: function (result) {
                    if (result.status == "0000" && result.data.message == "ok") {
                        $("#away").show();
                        var array = result.data.result;
                        var str = "";
                        for (var i in array) { // console.log("地址名称："+array[i].name)  ;console.log("地址经纬度："+array[i].location)
                            if (!array[i].uid) {
                                continue;
                            }
                            str += " <li onclick='getAway(this)' class=\"aui-list-item aui-list-item-middle\">\n" +
                                "                <div class=\"aui-list-item-inner aui-list-item-arrow\"  data_lat='" + array[i].location.lat + "' data_lng='" + array[i].location.lng + "' >\n" +
                                "                    " + array[i].name + "\n" +
                                "            </div></li>";
                        }
                        $("#away").html(str);
                    } else {//获取定位周边信息失败
                        alert("获取定位周边信息失败")
                    }
                }
            });
        })
    })

    //点击获取地理位置信息
    function getAway(ele) {
        $("#away").hide();
        var name = $(ele).find("div").text();
        var lat = $(ele).find("div").attr("data_lat");
        var lng = $(ele).find("div").attr("data_lng");
        $("#areainfo").val(name);
        $("#areainfo").attr("data_lat", lat);
        $("#areainfo").attr("data_lng", lng);
    }

    //跳转下单页面
    function createOrder(artId,distincts) {
      location.href="${ctxPath}/artificerMeans/createOrderPage?artId="+artId+"&distincts="+distincts;
    }

</script>
</html>